package com.aliyun.messagemgt.service;

import com.alibaba.algo.cooperation.common.BaseResult;
import com.alibaba.algo.cooperation.common.PagerEntity;
import com.alibaba.algo.cooperation.feign.service.OrgFeignService;
import com.alibaba.algo.cooperation.feign.service.PositionFeignService;
import com.alibaba.algo.cooperation.feign.service.RoleFeignService;
import com.alibaba.algo.cooperation.feign.service.UserFeignService;
import com.alibaba.algo.cooperation.feign.vo.req.*;
import com.alibaba.algo.cooperation.feign.vo.res.*;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.aliyun.messagemgt.common.dto.foura.DepartmentVo;
import com.aliyun.messagemgt.common.dto.foura.FourAMenu;
import com.aliyun.messagemgt.common.dto.foura.FouraGetFirstLevelOrgDTO;
import com.aliyun.messagemgt.common.dto.foura.FouraGetOrgListByParentIdQry;
import com.aliyun.messagemgt.common.dto.foura.FouraGetUserByOrgQry;
import com.aliyun.messagemgt.common.dto.foura.FouraOrgInfoDTO;
import com.aliyun.messagemgt.common.dto.foura.FouraOrgUserInfoDTO;
import com.aliyun.messagemgt.common.dto.foura.FouraPageRoleQry;
import com.aliyun.messagemgt.common.dto.foura.FouraPositionDTO;
import com.aliyun.messagemgt.common.dto.foura.FouraPositionUserInfoDTO;
import com.aliyun.messagemgt.common.dto.foura.FouraPositionUserQry;
import com.aliyun.messagemgt.common.dto.foura.FouraRoleDTO;
import com.aliyun.messagemgt.common.dto.foura.FouraRoleUserInfoDTO;
import com.aliyun.messagemgt.common.dto.foura.FouraRoleUserQry;
import com.aliyun.messagemgt.common.dto.foura.FouraUserInfoDTO;
import com.aliyun.messagemgt.common.dto.foura.FouraUserLoginQry;
import com.aliyun.messagemgt.common.dto.foura.FouraUserQry;
import com.aliyun.messagemgt.common.dto.foura.OrgInfo;
import com.aliyun.messagemgt.common.dto.foura.UserInfo;
import com.aliyun.messagemgt.common.dto.response.ResultMap;
import com.aliyun.messagemgt.convert.FouraConverter;
import com.aliyun.messagemgt.fouraplugin.FouraService;
import com.aliyun.messagemgt.util.ConverterUtil;
import com.aliyun.messagemgt.util.PageUtils;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Slf4j
@Service
@ConditionalOnProperty(prefix = "xxl.sso", name = "enable", havingValue = "false")
public class FouraServiceFireeyeImpl implements FouraService {

    @Override
    public Map<String, Object> getUser() {
        return null;
    }

    @Override
    public List<DepartmentVo> getAllDepartment() {
        return null;
    }

    @Override
    public ResultMap getOrganizationInfoByParentCode(String orgCode) {
        return null;
    }

    @Override
    public FourAMenu getAuthByUser() {
        String jsonText = "{\"menu\":[{\"key\":\"1-tspz\",\"name\":\"推送配置\",\"parent\":\"root\",\"url\":\"~\",\"order\":0,\"children\":[{\"key\":\"1qdgl-2\",\"name\":\"消息渠道管理\",\"parent\":\"1-tspz\",\"url\":\"messageCenter/channelManager/channelList\",\"order\":1,\"children\":null},{\"key\":\"2mbgl-2\",\"name\":\"消息模板管理\",\"parent\":\"1-tspz\",\"url\":\"~\",\"order\":2,\"children\":[{\"key\":\"2mblb-3\",\"name\":\"消息模板列表\",\"parent\":\"2mbgl-2\",\"url\":\"messageCenter/templateManager\",\"order\":1,\"children\":null},{\"key\":\"1dxjmgl-3\",\"name\":\"短信签名列表\",\"parent\":\"2mbgl-2\",\"url\":\"messageCenter/templateManager/smsManager\",\"order\":2,\"children\":null}]},{\"key\":\"3jszgl-2\",\"name\":\"接收组管理\",\"parent\":\"1-tspz\",\"url\":\"messageCenter/AcceptGroup/list\",\"order\":3,\"children\":null},{\"key\":\"4fsrwpz-2\",\"name\":\"发送任务配置\",\"parent\":\"1-tspz\",\"url\":\"messageCenter/messageManager/messageSource\",\"order\":4,\"children\":null},{\"key\":\"5xxfsjk-2\",\"name\":\"消息发送监控\",\"parent\":\"1-tspz\",\"url\":\"messageCenter/messageManager/messageSend\",\"order\":5,\"children\":null},{\"key\":\"6xxygl-2\",\"name\":\"消息源管理\",\"parent\":\"1-tspz\",\"url\":\"messageCenter/messageManager/msgSourceManage\",\"order\":6,\"children\":null}]},{\"key\":\"2-grzx\",\"name\":\"个人中心\",\"parent\":\"root\",\"url\":\"~\",\"order\":0,\"children\":[{\"key\":\"1wdxx-2\",\"name\":\"我的消息\",\"parent\":\"2-grzx\",\"url\":\"messageCenter/messageManager/myMessage\",\"order\":0,\"children\":null},{\"key\":\"2grxxgl-2\",\"name\":\"个人信息管理\",\"parent\":\"2-grzx\",\"url\":\"messageCenter/personalInfoMgt/userManagement\",\"order\":0,\"children\":null}]},{\"key\":\"3-xtgl\",\"name\":\"系统管理\",\"parent\":\"root\",\"url\":\"~\",\"order\":0,\"children\":[{\"key\":\"1zhxx-2\",\"name\":\"租户信息\",\"parent\":\"3-xtgl\",\"url\":\"messageCenter/messageManager/tenantManage\",\"order\":0},{\"key\":\"2rzgl-2\",\"name\":\"日志管理\",\"parent\":\"3-xtgl\",\"url\":\"~\",\"order\":0,\"children\":[{\"key\":\"1czrz-3\",\"name\":\"操作日志\",\"parent\":\"1rzgl-2\",\"url\":\"systemManager/systemMessage/operateLog\",\"order\":0,\"children\":null},{\"key\":\"2jkrz-3\",\"name\":\"接口日志\",\"parent\":\"1rzgl-2\",\"url\":\"systemManager/systemManage/interfaceLog\",\"order\":0,\"children\":null}]}]}]}";
        FourAMenu fourAMenu = JSONObject.parseObject(jsonText, FourAMenu.class);
        return fourAMenu;
    }


    @Override
    public String getSsoUser(HttpServletRequest request) {
        return null;
    }

    @Override
    public List<OrgInfo> getRootTree() {
        return new ArrayList<>();
    }

    @Override
    public PageInfo<UserInfo> getUserByOrgCode(String orgCode, String userName, Integer pageSize, Integer pageNo) {
        return null;
    }

    @Override
    public List<Map<String, Object>> getAllUserInfo(Integer pageSize, Integer pageNo) {
        return null;
    }

    @Override
    public int sync4AData() {
        return 0;
    }

    @Override
    public List<FouraOrgUserInfoDTO> selectUserByOrg(FouraGetUserByOrgQry qry) {
        return new ArrayList<>();
    }

    @Override
    public List<FouraGetFirstLevelOrgDTO> getFirstLevelOrgList() {
        return new ArrayList<>();
    }

    @Override
    public List<FouraOrgInfoDTO> getOrgListByParentOrgId(FouraGetOrgListByParentIdQry qry) {
        return new ArrayList<>();
    }

    @Override
    public PageInfo<FouraRoleDTO> selectRoleByPage(FouraPageRoleQry pageQry) {
        return new PageInfo();
    }

    /**
     * 根据组织id获取岗位信息
     *
     * @param orgId
     * @return
     */
    @Override
    public List<FouraPositionDTO> selectPositionByOrg(Long orgId) {
        return new ArrayList<>();
    }

    @Override
    public List<FouraPositionUserInfoDTO> qryUserListByPositionId(FouraPositionUserQry qry) {
        return new ArrayList<>();
    }

    @Override
    public List<FouraRoleUserInfoDTO> selectUserListByRoleIdListOrAppCodeList(FouraRoleUserQry qry) {
        return new ArrayList<>();
    }

    @Override
    public List<FouraUserInfoDTO> qryUserInfoByUserListOrAppCode(FouraUserQry qry) {
        return new ArrayList<>();
    }

    @Override
    public FouraUserInfoDTO checkLogin(FouraUserLoginQry fouraUserLoginQry) {
        return new FouraUserInfoDTO();
    }
}
